
package com.example.demo.fileRead;

import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject;

import java.io.File;

/**
 * Created by liujiahao on 2019/3/14.
 */
public class JsonFileRead {
    public static void main(String[] args) {
        String filepath="C:\\Users\\liujiahao\\Documents\\WeChat Files\\ljh-number\\FileStorage\\File\\2019-03\\20190121-20190312\\2019-01-21__2019-03-12";
        File file = new File(filepath);
        if(file.isDirectory()){
            String[] filelist = file.list();
            for (int i = 0; i < filelist.length; i++) {
                File readfile = new File(filepath + "\\" + filelist[i]);
                if (!readfile.isDirectory()) {
                    System.out.println("文件名=" + readfile.getName());
                    String json=FileUtil.readString(readfile,"utf-8");
                    JSONObject obj=JSONObject.parseObject(json);
                    System.out.println(obj);

                }
            }
        }

    }
}
